﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>德器烟气监控平台</title>
    <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
    <meta name="author" content="Vincent Garreau" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" media="screen" href="~/Content/H5Login/style.css">
    <link rel="stylesheet" type="text/css" href="~/Content/H5Login/reset.css" />
</head>
<body>
    <div id="particles-js">
        <div class="login">
            <div class="login-top">
                油烟在线监控平台
            </div>
            <div class="login-center clearfix">
                <div class="login-center-img"><img src="/Content/img/name.png" /></div>
                <div class="login-center-input">
                    <input type="text" name="UserName" value="" placeholder="请输入您的用户名" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的用户名'" />
                    <div class="login-center-input-text">用户名</div>
                </div>
            </div>
            <div class="login-center clearfix">
                <div class="login-center-img"><img src="/Content/img/password.png" /></div>
                <div class="login-center-input">
                    <input type="password" name="PassWord" value="" placeholder="请输入您的密码" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'" />
                    <div class="login-center-input-text">密码</div>
                </div>
            </div>
            <div class="login-button">
                登陆
            </div>
            <div class="login-center" style="font-size:16px;color:white;width:100%;margin-top:20px;margin-left: 26px;">
                ©2020 德器(重庆)科技有限公司 <br/>服务热线 400-9019-505
                @*重庆环元环境科学研究院*@
            </div>
        </div>
        <div class="sk-rotating-plane"></div>
    </div>
    <!-- scripts -->
    <script src="~/Scripts/H5Login/particles.min.js"></script>
    <script src="~/Scripts/H5Login/app.js"></script>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
    function hasClass(elem, cls) {
            cls = cls || '';
            if (cls.replace(/\s/g, '').length == 0) return false; //当cls没有参数时，返回false
            return new RegExp(' ' + cls + ' ').test(' ' + elem.className + ' ');
        }

        function addClass(ele, cls) {
            if (!hasClass(ele, cls)) {
                ele.className = ele.className == '' ? cls : ele.className + ' ' + cls;
            }
        }

        function removeClass(ele, cls) {
            if (hasClass(ele, cls)) {
                var newClass = ' ' + ele.className.replace(/[\t\r\n]/g, '') + ' ';
                while (newClass.indexOf(' ' + cls + ' ') >= 0) {
                    newClass = newClass.replace(' ' + cls + ' ', ' ');
                }
                ele.className = newClass.replace(/^\s+|\s+$/g, '');
            }
        }
        document.querySelector(".login-button").onclick = function () {

            var UserName = $("input[name='UserName']").val();
            var PassWord = $("input[name='PassWord']").val();
            if (UserName == "" || PassWord == "") {
                return;
            }
            //window.location.href = "/DataView/MainPage";
            $.post("/DataView/LoginCheck", { "UserName": UserName, "PassWord": PassWord }, function (msg) {

                if (msg.result == "OK") {
                    addClass(document.querySelector(".login"), "active");
                    addClass(document.querySelector(".sk-rotating-plane"), "active");
                    document.querySelector(".login").style.display = "none";
                    setTimeout(function () {
                        window.location.href = "/Panel/Index";
                    }, 1000);
                }
                else {
                    alert(msg.result);
                }
            });




            //setTimeout(function () {
            //    addClass(document.querySelector(".sk-rotating-plane"), "active")
            //    document.querySelector(".login").style.display = "none"
            //}, 800);

            //alert("登录成功");
            //setTimeout(function () {
            //    removeClass(document.querySelector(".login"), "active")
            //    removeClass(document.querySelector(".sk-rotating-plane"), "active")
            //    document.querySelector(".login").style.display = "block"
            //    alert("登录成功")

            //}, 5000);
        }</script>
</body>
</html>
